<div class="wide form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'web-setting-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array('enctype'=>'multipart/form-data'),
	'focus'=>Utils::AutoFocus($model,'key'),
)); ?>

	<?php echo $form->errorSummary($model); ?>

	<?php if ($model->description != ''): ?>
		<div class='box'>
			<?php echo $model->description ?>
		</div>
	<?php endif ?>

	<div class="row">
		<?php echo $form->labelEx($model,'key'); ?>
		<?php echo $form->textField($model,'key',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'key'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'value'); ?>
		
		<?php if($model->type=='textArea' && in_array($model->type_data, array('min','normal','full')))
		{
			NHtml::RegisterTinyMCE($model->type_data);
			echo $form->{$model->type}($model,'value',array('rows'=>6, 'cols'=>50));
		} 
		else if(stristr($model->type, 'list')>-1)
		{
			eval('$data='.$model->type_data.';');
			echo $form->{$model->type}($model,'value', $data, array('rows'=>6, 'cols'=>50));
		}
		else if($model->type=='fileField')
		{
			if($model->value=="")
				echo $form->{$model->type}($model,'value');
			else
			{
				echo CHtml::link(Yii::t('websetting', 'Xóa tập tin đính kèm'), array('removeFile','id'=>$model->id));
				echo CHtml::tag('br');
				echo NHtml::image($model->value);
			}
		}
		else if($model->type=='textField')
		{
			echo $form->{$model->type}($model,'value', array('size'=>60,'maxlength'=>100));
		}
		?>
		<?php echo $form->error($model,'value'); ?>
		
		
		<?php if ($model->default != ''): ?>
			<p class="hint">
				<?php echo Yii::t('websetting','Mặc định') ?>: <?php echo $model->default ?><br />
			</p>
		<?php endif ?>
	</div>

	<div class="row buttons">
		<div class="row buttons">
			<?php echo CHtml::submitButton(Yii::t('backend','Lưu và tiếp tục chỉnh sửa'), array('name'=>'save','class'=>'g-button g-button-submit')); ?>
			<?php echo CHtml::submitButton(Yii::t('backend','Hoàn tất'), array('name'=>'done','class'=>'g-button')); ?>

			<?php if( ! $model->isNewRecord) echo CHtml::button(Yii::t('websetting','Nhiều tính năng'), array('class'=>'g-button','onclick'=>'location="'.$this->createUrl('edit',array('id'=>$model->id)).'"')); ?>
		</div>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->